/*
 * 统一Modal私人订制
 */
import * as React from 'react';
import { Modal } from 'antd';

interface ModalProps {
  children: React.ReactNode;
  title?: any;
  onCancel?: () => any;
  onOk?: () => any;
  closable?: boolean;
  maskClosable?: boolean;
  visible?: boolean;
  className?: string;
  width?: any;
  footer?: any;
  style?: object;
  confirmLoading?: boolean;
  destroyOnClose?: boolean;
}

const defaultProps: ModalProps = {
  onCancel: () => {},
  onOk: () => {},
  title: false,
  closable: false,
  maskClosable: true,
  visible: true,
  className: '',
  width: '80%',
  children: null,
  confirmLoading: false,
  destroyOnClose: true,
  style: {},
};

const CustomModal: React.SFC<ModalProps> = props => {
  const style = { ...props.style, top: 60 };
  return (
    <Modal {...props} style={style}>
      {props.children}
    </Modal>
  );
};

CustomModal.defaultProps = defaultProps;

export default CustomModal;
